﻿<UserControl 
    x:Class="FU.Capstones.IMS.Web.Silverlight.Views.EmploymentTypeList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:Controls="clr-namespace:FU.Capstones.IMS.Web.Silverlight.Controls" 
    xmlns:Navigation="clr-namespace:Navigation.Silverlight;assembly=Navigation.Silverlight"
    xmlns:Common="clr-namespace:FU.Capstones.IMS.Web.Common;assembly=FU.Capstones.IMS.Web.Common"
    xmlns:TControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data" 
    Navigation:ViewModel.TypeName="FU.Capstones.IMS.Web.Silverlight.ViewModels.EmploymentTypeListViewModel">

    <UserControl.Resources>
        <Common:DataContextProxy x:Key="DataContextProxy" />
    </UserControl.Resources>

    <telerik:RadBusyIndicator 
        BusyContent="Vui lòng đợi khi dữ liệu đang được xử lý!" 
        IsBusy="{Binding Path=ServiceCallCounter, Converter={StaticResource IntegerToBoolConverter}}">
        <Grid x:Name="LayoutRoot" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="10"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!--Title-->
            <Grid Grid.ColumnSpan="3">
                <Grid.Background>
                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                        <GradientStop Color="{StaticResource OuterColor}" Offset="{StaticResource ControlBackgroundGradientStop0}"/>
                        <GradientStop Color="{StaticResource InnerColor}" Offset="{StaticResource ControlBackgroundGradientStop1}"/>
                        <GradientStop Color="{StaticResource InnerColor}" Offset="{StaticResource ControlBackgroundGradientStop2}"/>
                        <GradientStop Color="{StaticResource OuterColor}" Offset="{StaticResource ControlBackgroundGradientStop3}"/>
                    </LinearGradientBrush>
                </Grid.Background>

                <TextBlock 
                    x:Name="lblTitle" 
                    Style="{StaticResource TextBlockTitlePageStyle}"                   
                    Text="{StaticResource EmploymentTypeListPageTitle}"/>
            </Grid>

            <!--Search Bar-->
            <Controls:EmploymentTypeSearchControl Grid.Column="1" Grid.Row="2" Background="Transparent" Margin="5,0"/>

            <!--GridView-->
            <telerikGrid:RadGridView
                x:Name="grdEmploymentType" 
                Grid.Row="4" Grid.Column="1" 
                telerik:StyleManager.Theme="Office_Black"
                Style="{StaticResource RadGridViewNormal}"
                ItemsSource="{Binding Path=EmploymentTypeCollection, Mode=TwoWay}"
                >

                <telerikGrid:RadGridView.Columns>

                    <telerikGrid:GridViewDataColumn 
                        Header="{StaticResource EmploymentTypeCodeLabelText}"
                        Width="100" HeaderTextAlignment="Center">
                        <telerikGrid:GridViewDataColumn.CellTemplate>
                            <DataTemplate>
                                <HyperlinkButton 
                                    Content="{Binding Path=EmploymentTypeCode}"  
                                    Command="{Binding Path=DataSource.EditCommand, Source={StaticResource DataContextProxy}}"
                                    CommandParameter="{Binding Path=EmploymentTypeID}"
                                />
                            </DataTemplate>
                        </telerikGrid:GridViewDataColumn.CellTemplate>
                    </telerikGrid:GridViewDataColumn>

                    <telerikGrid:GridViewDataColumn 
                        Header="{StaticResource EmploymentTypeNameLabelText}"
                        Width="150" HeaderTextAlignment="Center"
                        DataMemberBinding="{Binding Path=EmploymentTypeName}"
                    />

                    <telerikGrid:GridViewDataColumn 
                        Header="{StaticResource BriefDescriptionLabelText}"
                        Width="250" HeaderTextAlignment="Center"
                        DataMemberBinding="{Binding Path=BriefDescription}"
                    />

                    <telerikGrid:GridViewColumn Width="70" HeaderTextAlignment="Center">
                        <telerikGrid:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <HyperlinkButton 
                                        Content="{StaticResource DeleteButtonText}"    
                                        Command="{Binding Path=DataSource.DeleteCommand, Source={StaticResource DataContextProxy}}"
                                        CommandParameter="{Binding Path=EmploymentTypeID}"
                                        IsEnabled="{Binding Path=DataSource.CanEditOrAdd, Source={StaticResource DataContextProxy}}"
                                        Visibility="{Binding Path=IsDelete, Converter={StaticResource InverseBoolToVisibilityConverter}}"
                                    />
                                    <TextBlock 
								        Text="{StaticResource DeletedLabelText}"
                                        Style="{StaticResource TextBlockNormalStyle}"                                        
                                        Visibility="{Binding Path=IsDelete, Converter={StaticResource BoolToVisibilityConverter}}"
                                    />
                                </Grid>
                            </DataTemplate>
                        </telerikGrid:GridViewColumn.CellTemplate>
                    </telerikGrid:GridViewColumn>
                </telerikGrid:RadGridView.Columns>
            </telerikGrid:RadGridView>
            
            <!--Button-->

            <!--Button-->
            <Grid Grid.Row="5" Grid.Column="1">

                <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                    <Controls:AddButtonControl                         
                        Visibility ="{Binding Path=CanAdd, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                        />
                    <Controls:ShowAllCheckBoxControl  
                        Visibility ="{Binding Path=CanEditOrAdd, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"                  
                        />
                </StackPanel>

                <TControls:RadDataPager
                    x:Name="DataPager"
                    Source="{Binding Path=EmploymentTypeCollection, Mode=TwoWay}"
                    Style="{StaticResource DataPagerNormalStyle}"
                    />
            </Grid>
        </Grid>
    </telerik:RadBusyIndicator>
</UserControl>
